import axios from 'axios'

const apiClient = axios.create({
    baseURL: process.env.VUE_APP_API_BASE_URL,
    timeout: 10000,
    headers: {
        'Content-Type': 'application/json'
    }
})

export default {
    // 个人中心
    getUserInfo(userId) {
        return apiClient.get(`/users/${userId}`)
    },

    // 人才招聘
    getPendingCandidates(params) {
        return apiClient.get('/recruitment/pending', { params })
    },
    updateCandidateStatus(id, status) {
        return apiClient.put(`/recruitment/${id}/status`, { status })
    },

    // 人事管理
    getOnboardingList(params) {
        return apiClient.get('/personnel/onboarding', { params })
    },
    createOnboardingRecord(data) {
        return apiClient.post('/personnel/onboarding', data)
    },
    updateOnboardingRecord(id, data) {
        return apiClient.put(`/personnel/onboarding/${id}`, data)
    },
    deleteOnboardingRecord(id) {
        return apiClient.delete(`/personnel/onboarding/${id}`)
    },

    // 权限管理
    getOrgTree() {
        return apiClient.get('/permission/org-tree')
    },
    getPermissions(nodeId) {
        return apiClient.get(`/permission/${nodeId}`)
    },
    updatePermissions(data) {
        return apiClient.put('/permission', data)
    }
}